From: Keir Fraser Date: Mon, 20 Oct 2008 14:13:50 +0000 (+0100) Subject: Define a macro IO_APIC_ID() for x86. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14066^2~26 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=d69c0f4bbed02762a4e1dff9a5e4da681f1d2867;p=xen.git Define a macro IO_APIC_ID() for x86. Signed-off-by: Anthony Xu Signed-off-by: Dexuan Cui --- diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c index 8325e72d40..b9b35126ad 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -179,7 +180,7 @@ unsigned int io_apic_read_remap_rte( struct IO_xAPIC_route_entry old_rte = { 0 }; struct IO_APIC_route_remap_entry *remap_rte; int rte_upper = (reg & 1) ? 1 : 0; - struct iommu *iommu = ioapic_to_iommu(mp_ioapics[apic].mpc_apicid); + struct iommu *iommu = ioapic_to_iommu(IO_APIC_ID(apic)); struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu); if ( !iommu || !ir_ctrl || ir_ctrl->iremap_maddr == 0 || @@ -224,7 +225,7 @@ void io_apic_write_remap_rte( struct IO_xAPIC_route_entry old_rte = { 0 }; struct IO_APIC_route_remap_entry *remap_rte; unsigned int rte_upper = (reg & 1) ? 1 : 0; - struct iommu *iommu = ioapic_to_iommu(mp_ioapics[apic].mpc_apicid); + struct iommu *iommu = ioapic_to_iommu(IO_APIC_ID(apic)); struct ir_ctrl *ir_ctrl = iommu_ir_ctrl(iommu); int saved_mask; @@ -253,7 +254,7 @@ void io_apic_write_remap_rte( *(IO_APIC_BASE(apic)+4) = *(((int *)&old_rte)+0); remap_rte->mask = saved_mask; - if ( ioapic_rte_to_remap_entry(iommu, mp_ioapics[apic].mpc_apicid, + if ( ioapic_rte_to_remap_entry(iommu, IO_APIC_ID(apic), &old_rte, rte_upper, value) ) { *IO_APIC_BASE(apic) = rte_upper ? (reg + 1) : reg; diff --git a/xen/include/asm-x86/io_apic.h b/xen/include/asm-x86/io_apic.h index 6124d0fae0..f7569cebed 100644 --- a/xen/include/asm-x86/io_apic.h +++ b/xen/include/asm-x86/io_apic.h @@ -20,6 +20,8 @@ ((volatile int *)(__fix_to_virt(FIX_IO_APIC_BASE_0 + idx) \ + (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK))) +#define IO_APIC_ID(idx) (mp_ioapics[idx].mpc_apicid) + /* * The structure of the IO-APIC: */